package wei.xinya.pattern.creational.singleton;

/**
 * 懒汉:方法加锁单例模式
 */
public class Lock1Singleton {
    private static Lock1Singleton singleton;

    private Lock1Singleton() {
    }

    public static synchronized Lock1Singleton getSingleton() {
        if (singleton == null) {
            singleton = new Lock1Singleton();
        }
        return singleton;
    }
}
